<!doctype html>
<meta charset="utf-8">
<title>Traversing history causes iframe contentWindow to update</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe src="resources/first.html"></iframe>
<script>
  var iframe = document.querySelector('iframe');
  var t = async_test();
  onload = t.step_func(function() {
    iframe.onload = t.step_func(function() {
      assert_true(iframe.contentWindow.location.href.endsWith('second.html'));
      iframe.contentWindow.history.back();
      t.step_timeout(function() {
        assert_true(iframe.contentWindow.location.href.endsWith('first.html'));
        iframe.contentWindow.history.forward();
        t.step_timeout(function() {
          assert_true(iframe.contentWindow.location.href.endsWith('second.html'));
          t.done();
        }, 1000);
      }, 1000);
    });
    iframe.src = "resources/second.html";
  });
</script>
